package project;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.util.*;
import com.toedter.calendar.*;

//This is an unnecessary comment
public class DetailsPanel extends JPanel
{
	JTextField clientIDT = null, nameT = null,
			surnameT = null, initialsT = null,
			idNumberT = null, phoneOneT = null,
			phoneTwoT = null, emailT = null, empIDT = null;
	JComboBox titleJCB = null, custStatusJCB = null,
				accessLevelJCB = null;
	JDateChooser jdc;
	JButton newPasswordB = null;
	
	public DetailsPanel(String type)
	{
		if(type.equals("Add"))
		{
			String[] labels = {"<html><b>Client ID: </b></html>", 
								"Surname: ", "First Name: ",
								"Middle Initial(s): ", "Title: ",
								"ID Number:",
								"Phone No.: ", "Phone No.: ",
								"Email: ", "Date of Birth: ",
								"Status: ",""};
			int numPairs = labels.length;

			this.setLayout(new SpringLayout());
			JLabel clientIDL = new JLabel(labels[0], JLabel.TRAILING);
			JLabel surnameL = new JLabel(labels[1], JLabel.TRAILING);
			JLabel nameL = new JLabel(labels[2], JLabel.TRAILING);
			JLabel initialsL = new JLabel(labels[3], JLabel.TRAILING);
			JLabel titleL = new JLabel(labels[4], JLabel.TRAILING);
			JLabel idNumberL = new JLabel(labels[5], JLabel.TRAILING);
			JLabel phoneOneL = new JLabel(labels[6], JLabel.TRAILING);
			JLabel phoneTwoL = new JLabel(labels[7], JLabel.TRAILING);
			JLabel emailL = new JLabel(labels[8], JLabel.TRAILING);
			JLabel dobL = new JLabel(labels[9], JLabel.TRAILING);
			JLabel statusL = new JLabel(labels[10], JLabel.TRAILING);
			JLabel blankLabel = new JLabel(labels[11], JLabel.TRAILING);
			
			JLabel otherBlank = new JLabel("");
			clientIDT = new JTextField(10);
			nameT = new JTextField(30);
			surnameT = new JTextField(30);
			initialsT = new JTextField(30);
			idNumberT = new JTextField(30);
			phoneOneT = new JTextField(30);
			phoneTwoT = new JTextField(30);
			emailT = new JTextField(30);
			Vector vect1 = new Vector();
			vect1.add("");
			vect1.add("Mr");
			vect1.add("Ms");
			vect1.add("Mrs");
			vect1.add("Miss");
			vect1.add("Dr");
			vect1.add("Sir");
			vect1.add("Prof");
			titleJCB = new JComboBox(vect1);
			Vector vect2 = new Vector();
			vect2.add("");
			vect2.add("Good");
			vect2.add("Bad");
			custStatusJCB = new JComboBox(vect2);
			jdc = new JDateChooser();
			this.add(clientIDL);
			clientIDL.setLabelFor(clientIDT);
			this.add(clientIDT);
			this.add(surnameL);
			surnameL.setLabelFor(surnameT);
			this.add(surnameT);
			this.add(nameL);
			nameL.setLabelFor(nameT);
			this.add(nameT);
			this.add(initialsL);
			initialsL.setLabelFor(initialsT);
			this.add(initialsT);
			this.add(titleL);
			titleL.setLabelFor(titleJCB);
			this.add(titleJCB);
			this.add(idNumberL);
			idNumberL.setLabelFor(idNumberT);
			this.add(idNumberT);
			this.add(phoneOneL);
			phoneOneL.setLabelFor(phoneOneT);
			this.add(phoneOneT);
			this.add(phoneTwoL);
			phoneTwoL.setLabelFor(phoneTwoT);
			this.add(phoneTwoT);
			this.add(emailL);
			emailL.setLabelFor(emailT);
			this.add(emailT);
			this.add(dobL);
			dobL.setLabelFor(jdc);
			this.add(jdc);
			this.add(statusL);
			statusL.setLabelFor(custStatusJCB);
			this.add(custStatusJCB);
			this.add(blankLabel);
			blankLabel.setBorder(
				BorderFactory.createEmptyBorder(0,0,25,0));
			blankLabel.setLabelFor(otherBlank);
			this.add(otherBlank);
			otherBlank.setBorder(
				BorderFactory.createEmptyBorder(0,0,25,0));

			//Lay out panel
			SpringUtilities.makeCompactGrid(this,
	                                        numPairs, 2, //rows, cols
	                                        6, 6,        //initX, initY
	                                        5, 5);       //xPad, yPad

			Font font = nameL.getFont();
			String fontName = font.getFontName();
			font = new Font(fontName, Font.ITALIC, 13);
			this.setBorder(BorderFactory.createTitledBorder(
									null,
			                     	"Details",
	                                TitledBorder.DEFAULT_JUSTIFICATION,
	                                TitledBorder.DEFAULT_POSITION,
	                                font));
			this.setOpaque(true);
		}
		if(type.equals("Look"))
		{
			String[] labels = {"<html><b>Client ID: </b></html>", 
								"Surname: ", "First Name: ",
								"Middle Initial(s): ", "Title: ",
								"ID Number:",
								"Phone No.: ", "Phone No.: ",
								"Email: ", "Date of Birth: ",
								"Status: ",""};
			int numPairs = labels.length;

			this.setLayout(new SpringLayout());
			JLabel clientIDL = new JLabel(labels[0], JLabel.TRAILING);
			JLabel surnameL = new JLabel(labels[1], JLabel.TRAILING);
			JLabel nameL = new JLabel(labels[2], JLabel.TRAILING);
			JLabel initialsL = new JLabel(labels[3], JLabel.TRAILING);
			JLabel titleL = new JLabel(labels[4], JLabel.TRAILING);
			JLabel idNumberL = new JLabel(labels[5], JLabel.TRAILING);
			JLabel phoneOneL = new JLabel(labels[6], JLabel.TRAILING);
			JLabel phoneTwoL = new JLabel(labels[7], JLabel.TRAILING);
			JLabel emailL = new JLabel(labels[8], JLabel.TRAILING);
			JLabel dobL = new JLabel(labels[9], JLabel.TRAILING);
			JLabel statusL = new JLabel(labels[10], JLabel.TRAILING);
			JLabel buttonL = new JLabel(labels[11], JLabel.TRAILING);

			newPasswordB = new JButton("Password");
			clientIDT = new JTextField(10);
			nameT = new JTextField(30);
			surnameT = new JTextField(30);
			initialsT = new JTextField(30);
			idNumberT = new JTextField(30);
			phoneOneT = new JTextField(30);
			phoneTwoT = new JTextField(30);
			emailT = new JTextField(30);
			Vector vect1 = new Vector();
			vect1.add("");
			vect1.add("Mr");
			vect1.add("Ms");
			vect1.add("Mrs");
			vect1.add("Miss");
			vect1.add("Dr");
			vect1.add("Sir");
			vect1.add("Prof");
			titleJCB = new JComboBox(vect1);
			Vector vect2 = new Vector();
			vect2.add("");
			vect2.add("Good");
			vect2.add("Bad");
			custStatusJCB = new JComboBox(vect2);
			jdc = new JDateChooser();
			this.add(clientIDL);
			clientIDL.setLabelFor(clientIDT);
			this.add(clientIDT);
			this.add(surnameL);
			surnameL.setLabelFor(surnameT);
			this.add(surnameT);
			this.add(nameL);
			nameL.setLabelFor(nameT);
			this.add(nameT);
			this.add(initialsL);
			initialsL.setLabelFor(initialsT);
			this.add(initialsT);
			this.add(titleL);
			titleL.setLabelFor(titleJCB);
			this.add(titleJCB);
			this.add(idNumberL);
			idNumberL.setLabelFor(idNumberT);
			this.add(idNumberT);
			this.add(phoneOneL);
			phoneOneL.setLabelFor(phoneOneT);
			this.add(phoneOneT);
			this.add(phoneTwoL);
			phoneTwoL.setLabelFor(phoneTwoT);
			this.add(phoneTwoT);
			this.add(emailL);
			emailL.setLabelFor(emailT);
			this.add(emailT);
			this.add(dobL);
			dobL.setLabelFor(jdc);
			this.add(jdc);
			this.add(statusL);
			statusL.setLabelFor(custStatusJCB);
			this.add(custStatusJCB);
			this.add(buttonL);
			buttonL.setLabelFor(newPasswordB);
			this.add(newPasswordB);
			
			//Lay out panel
			SpringUtilities.makeCompactGrid(this,
	                                        numPairs, 2, //rows, cols
	                                        6, 6,        //initX, initY
	                                        5, 5);       //xPad, yPad

			Font font = nameL.getFont();
			String fontName = font.getFontName();
			font = new Font(fontName, Font.ITALIC, 13);
			this.setBorder(BorderFactory.createTitledBorder(
									null,
			                     	"Details",
	                                TitledBorder.DEFAULT_JUSTIFICATION,
	                                TitledBorder.DEFAULT_POSITION,
	                                font));
			this.setOpaque(true);
		}
		
	}
	public DetailsPanel(String employee, String type)
	{
		if(type.equals("add"))
		{
			String[] labels2 = {"<html><b>Employee ID: </b></html>", 
								"Surname: ", "First Name: ",
								"Middle Initial(s): ", "Title: ",
								"ID Number:",
								"Phone No.: ", "Phone No.: ",
								"Email: ", "Date of Birth: ",
								"Access Level: ",""};
			int numPairs = labels2.length;

			this.setLayout(new SpringLayout());
			JLabel empIDL = new JLabel(labels2[0], JLabel.TRAILING);
			JLabel surnameL = new JLabel(labels2[1], JLabel.TRAILING);
			JLabel nameL = new JLabel(labels2[2], JLabel.TRAILING);
			JLabel initialsL = new JLabel(labels2[3], JLabel.TRAILING);
			JLabel titleL = new JLabel(labels2[4], JLabel.TRAILING);
			JLabel idNumberL = new JLabel(labels2[5], JLabel.TRAILING);
			JLabel phoneOneL = new JLabel(labels2[6], JLabel.TRAILING);
			JLabel phoneTwoL = new JLabel(labels2[7], JLabel.TRAILING);
			JLabel emailL = new JLabel(labels2[8], JLabel.TRAILING);
			JLabel dobL = new JLabel(labels2[9], JLabel.TRAILING);
			JLabel accessLevelL = new JLabel(labels2[10], JLabel.TRAILING);
			JLabel blankLabel = new JLabel(labels2[11], JLabel.TRAILING);
			
			JLabel otherBlank = new JLabel("");
			empIDT = new JTextField(10);
			nameT = new JTextField(30);
			surnameT = new JTextField(30);
			initialsT = new JTextField(30);
			idNumberT = new JTextField(30);
			phoneOneT = new JTextField(30);
			phoneTwoT = new JTextField(30);
			emailT = new JTextField(30);
			Vector vect1 = new Vector();
			vect1.add("");
			vect1.add("Mr");
			vect1.add("Ms");
			vect1.add("Mrs");
			vect1.add("Miss");
			vect1.add("Dr");
			vect1.add("Sir");
			vect1.add("Prof");
			titleJCB = new JComboBox(vect1);
			Vector vect2 = new Vector();
			vect2.add("");
			vect2.add("Assistant");
			vect2.add("Stock Controller");
			vect2.add("Manager");
			accessLevelJCB = new JComboBox(vect2);
			jdc = new JDateChooser();
			this.add(empIDL);
			empIDL.setLabelFor(empIDT);
			this.add(empIDT);
			this.add(surnameL);
			surnameL.setLabelFor(surnameT);
			this.add(surnameT);
			this.add(nameL);
			nameL.setLabelFor(nameT);
			this.add(nameT);
			this.add(initialsL);
			initialsL.setLabelFor(initialsT);
			this.add(initialsT);
			this.add(titleL);
			titleL.setLabelFor(titleJCB);
			this.add(titleJCB);
			this.add(idNumberL);
			idNumberL.setLabelFor(idNumberT);
			this.add(idNumberT);
			this.add(phoneOneL);
			phoneOneL.setLabelFor(phoneOneT);
			this.add(phoneOneT);
			this.add(phoneTwoL);
			phoneTwoL.setLabelFor(phoneTwoT);
			this.add(phoneTwoT);
			this.add(emailL);
			emailL.setLabelFor(emailT);
			this.add(emailT);
			this.add(dobL);
			dobL.setLabelFor(jdc);
			this.add(jdc);
			this.add(accessLevelL);
			accessLevelL.setLabelFor(accessLevelJCB);
			this.add(accessLevelJCB);
			this.add(blankLabel);
			blankLabel.setBorder(
				BorderFactory.createEmptyBorder(0,0,25,0));
			blankLabel.setLabelFor(otherBlank);
			this.add(otherBlank);
			otherBlank.setBorder(
				BorderFactory.createEmptyBorder(0,0,25,0));

			//Lay out panel
			SpringUtilities.makeCompactGrid(this,
	                                        numPairs, 2, //rows, cols
	                                        6, 6,        //initX, initY
	                                        5, 5);       //xPad, yPad

			Font font = nameL.getFont();
			String fontName = font.getFontName();
			font = new Font(fontName, Font.ITALIC, 13);
			this.setBorder(BorderFactory.createTitledBorder(
									null,
			                     	"Details",
	                                TitledBorder.DEFAULT_JUSTIFICATION,
	                                TitledBorder.DEFAULT_POSITION,
	                                font));
			this.setOpaque(true);
		}
		if(type.equals("look"))
		{
			String[] labels2 = {"<html><b>Employee ID: </b></html>", 
								"Surname: ", "First Name: ",
								"Middle Initial(s): ", "Title: ",
								"ID Number:",
								"Phone No.: ", "Phone No.: ",
								"Email: ", "Date of Birth: ",
								"Access Level: ",""};
			int numPairs = labels2.length;

			this.setLayout(new SpringLayout());
			JLabel empIDL = new JLabel(labels2[0], JLabel.TRAILING);
			JLabel surnameL = new JLabel(labels2[1], JLabel.TRAILING);
			JLabel nameL = new JLabel(labels2[2], JLabel.TRAILING);
			JLabel initialsL = new JLabel(labels2[3], JLabel.TRAILING);
			JLabel titleL = new JLabel(labels2[4], JLabel.TRAILING);
			JLabel idNumberL = new JLabel(labels2[5], JLabel.TRAILING);
			JLabel phoneOneL = new JLabel(labels2[6], JLabel.TRAILING);
			JLabel phoneTwoL = new JLabel(labels2[7], JLabel.TRAILING);
			JLabel emailL = new JLabel(labels2[8], JLabel.TRAILING);
			JLabel dobL = new JLabel(labels2[9], JLabel.TRAILING);
			JLabel accessLevelL = new JLabel(labels2[10], JLabel.TRAILING);
			JLabel buttonL = new JLabel(labels2[11], JLabel.TRAILING);

			newPasswordB = new JButton("Password");
			empIDT = new JTextField(10);
			nameT = new JTextField(30);
			surnameT = new JTextField(30);
			initialsT = new JTextField(30);
			idNumberT = new JTextField(30);
			phoneOneT = new JTextField(30);
			phoneTwoT = new JTextField(30);
			emailT = new JTextField(30);
			Vector vect1 = new Vector();
			vect1.add("");
			vect1.add("Mr");
			vect1.add("Ms");
			vect1.add("Mrs");
			vect1.add("Miss");
			vect1.add("Dr");
			vect1.add("Sir");
			vect1.add("Prof");
			titleJCB = new JComboBox(vect1);
			Vector vect2 = new Vector();
			vect2.add("");
			vect2.add("Assistant");
			vect2.add("Stock Controller");
			vect2.add("Manager");
			accessLevelJCB = new JComboBox(vect2);
			jdc = new JDateChooser();
			this.add(empIDL);
			empIDL.setLabelFor(empIDT);
			this.add(empIDT);
			this.add(surnameL);
			surnameL.setLabelFor(surnameT);
			this.add(surnameT);
			this.add(nameL);
			nameL.setLabelFor(nameT);
			this.add(nameT);
			this.add(initialsL);
			initialsL.setLabelFor(initialsT);
			this.add(initialsT);
			this.add(titleL);
			titleL.setLabelFor(titleJCB);
			this.add(titleJCB);
			this.add(idNumberL);
			idNumberL.setLabelFor(idNumberT);
			this.add(idNumberT);
			this.add(phoneOneL);
			phoneOneL.setLabelFor(phoneOneT);
			this.add(phoneOneT);
			this.add(phoneTwoL);
			phoneTwoL.setLabelFor(phoneTwoT);
			this.add(phoneTwoT);
			this.add(emailL);
			emailL.setLabelFor(emailT);
			this.add(emailT);
			this.add(dobL);
			dobL.setLabelFor(jdc);
			this.add(jdc);
			this.add(accessLevelL);
			accessLevelL.setLabelFor(accessLevelJCB);
			this.add(accessLevelJCB);
			this.add(buttonL);
			buttonL.setLabelFor(newPasswordB);
			this.add(newPasswordB);

			//Lay out panel
			SpringUtilities.makeCompactGrid(this,
	                                        numPairs, 2, //rows, cols
	                                        6, 6,        //initX, initY
	                                        5, 5);       //xPad, yPad

			Font font = nameL.getFont();
			String fontName = font.getFontName();
			font = new Font(fontName, Font.ITALIC, 13);
			this.setBorder(BorderFactory.createTitledBorder(
									null,
			                     	"Details",
	                                TitledBorder.DEFAULT_JUSTIFICATION,
	                                TitledBorder.DEFAULT_POSITION,
	                                font));
			this.setOpaque(true);
		}
		
	}

}